package com.ws.genercity.demo11;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @author 13353
 */
public class MainClass11 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        //使用反射
//        Class<Person> clz = Person.class;
//        Constructor<Person> constructor = clz.getConstructor();
//        Person person = constructor.newInstance();

        Class personClass = Person.class;
        Constructor constructor = personClass.getConstructor();
        //还需要在进行类型转换。
        Object o = constructor.newInstance();



    }
}
